
from selenium import webdriver
import time
import allure
from common.handle_path import screenshot_path
driver = webdriver.Chrome()
driver.get("https://www.baidu.com")

# 图片存放路径处理
driver.save_screenshot(rf"{screenshot_path}\screenshot_{int(time.time() * 1000)}.png")

# 用allure attach方法 把截图放到allure 报告里
allure.attach(driver.get_screenshot_as_png(),name="失败用例截图",attachment_type=allure.attachment_type.PNG)

driver.quit()